
const Vue = require('vue')
const server = require('express')()
const renderer = require('vue-server-renderer').createRenderer()

const renderer = createRenderer({
  template: require('fs').readFileSync('./index.template.html', 'utf-8')
})

// 声明一个变量用作渲染模板的数据
const context = {
  title: 'hello',
  meta: `
    <meta charset="utf-8">
  `
}

renderer.renderToString(app, context, (err, html) => {
  console.log(html) // html 将是注入应用程序内容的完整页面
})